<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>忘记密码 - 云文档平台</title>
    <link rel="stylesheet" href="static/css/bootstrap.min.css">
    <link rel="stylesheet" href="static/css/auth.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        if(!window.jQuery) {
            document.write('<script src="static/js/jquery-3.6.0.min.js"><\/script>');
        }
    </script>
</head>
<body>
<div class="auth-container">
    <div class="card">
        <div class="card-header">
            <h4>重置密码</h4>
        </div>
        <div class="card-body">
            <form id="resetPasswordForm">
                <div class="form-group">
                    <label for="resetEmail">邮箱</label>
                    <div class="input-group">
                        <input type="email" class="form-control" id="resetEmail"
                               placeholder="请输入注册时使用的邮箱" required>
                        <div class="input-group-append">
                            <button class="btn btn-outline-secondary" type="button"
                                    id="sendResetCodeBtn" onclick="Auth.sendResetCode()">
                                发送验证码
                            </button>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="resetCode">邮箱验证码</label>
                    <input type="text" class="form-control" id="resetCode"
                           placeholder="请输入6位验证码" required>
                </div>

                <div class="form-group">
                    <label for="resetPassword">新密码</label>
                    <input type="password" class="form-control" id="resetPassword"
                           placeholder="8-20位，包含大小写字母和数字" required>
                    <small class="form-text text-muted">必须包含大小写字母、数字和特殊符号</small>
                </div>

                <div class="form-group">
                    <label for="resetConfirmPassword">确认密码</label>
                    <input type="password" class="form-control" id="resetConfirmPassword"
                           placeholder="请再次输入新密码" required>
                </div>

                <button type="submit" class="btn btn-primary btn-block">重置密码</button>
            </form>
            <div class="auth-links">
                <a href="/Cloud/login.html">返回登录</a>
            </div>
        </div>
    </div>

    <!-- 加载指示器 -->
    <div class="loading hidden" id="loading">
        <div class="loading-spinner"></div>
    </div>

    <!-- 提示信息 -->
    <div id="toast" class="hidden"></div>
</div>

<!-- 引入核心脚本 -->
<script src="static/js/ui-components.js"></script>
<script src="static/js/api-service.js"></script>
<script src="static/js/main-script.js"></script>
<script src="static/js/test.js"></script>
<script src="static/js/auth.js"></script>

<script>
    $(document).ready(function() {
        // 确保UI控制器已初始化
        if (window.UIController) {
            // 隐藏加载指示器
            UIController.hideLoading();
        }

        // 绑定表单提交事件
        $("#resetPasswordForm").submit(function(e) {
            e.preventDefault();
            Auth.resetPassword();
        });

        // // 绑定发送验证码按钮事件
        // $("#sendResetCodeBtn").click(function() {
        //     Auth.sendResetCode();
        // });

        // 如果Auth中有专门的初始化方法，则调用它
        if (Auth && typeof Auth.initForgotPasswordPage === 'function') {
            Auth.initForgotPasswordPage();
        }

        console.log('重置密码页面加载完成');
    });
</script>
</body>
</html>